<?php 
	$keywords = array(
		"name" => "keywords",
		"id" => "keywords",
		"value" => "",
		"class" => "keywords",
		"maxlength" => 50,
	);
	$submit = array(
		"name" => "submit",
		"id" => "submit",
		"value" => lang('label_search_submit'),
		"class" => "form-button",
	);
?>
<div class="top shadow sized">

</div>

<div class="content">
	<?php foreach($ngos as $ngo) : ?>
	<div class="ngo-container">
		<div class="ngo-wrap">
			<div class="ngo-content">
				<div class="ngo ngo-shadow">
					<div class="name orange shadow-thin"><?=$ngo->name?></div>
					<div class="header">
						<div class="logo"><img src="/static/ngo/<?=$ngo->id?>/<?=$ngo->logo?>" alt="<?=$ngo->name?>" title="<?=$ngo->name?>" /></div>
						<div class="info shadow-thin">
							<table>
								<tr>
									<td class="label"><?=lang('label_ngos_address')?>:</td>
									<td>
										<?=$ngo->address_1?> - <?=$ngo->address_2?><br/>
										<?=$ngo->zip?> <?=$ngo->city?><br/>
										<?=$ngo->state?>, <?=$ngo->country->$uilang?>
									</td>
								</tr>
								<tr>
									<td class="label"><?=lang('label_ngos_intervention_areas')?>:</td>
									<td>
										<?php foreach($ngo->zones as $i=>$z) : ?>
											<a href="/ngos/a/<?=$z->id?>" class="orange-d"><?=$z->$uilang?></a><?=($i<count($ngo->zones->all)-1) ? ", " : "."; ?>
										<?php endforeach; ?>
									</td>
								</tr>
								
								<tr>
									<td class="label"><?=lang('label_ngos_causes')?>:</td>
									<td>
										<?php foreach($ngo->causes as $i=>$c) : ?>
											<a href="/ngos/c/<?=$c->id?>" class="orange-d"><?=$c->$uilang?></a><?=($i<count($ngo->causes->all)-1) ? ", " : "."; ?>
										<?php endforeach; ?>
									</td>
								</tr>
								<tr>
									<td class="label"><?=lang('label_ngos_site_web')?>:</td>
									<td>
										<a href="<?=prep_url($ngo->url)?>"><?=$ngo->url?></a>
									</td>
								</tr>
							</table>
						</div>
						<div class="clearfix"></div>
					</div>
				
					<div class="sec-menu-wrap shadow-thin">
						<div class="sec-menu">
							<ul>
								<li class="description"><a class="orange-d"><?=lang('label_ngos_description')?></a></li>
								<li class="projects"><a class="orange-d"><?=lang('label_ngos_projects')?></a></li>
								<li class="stats"><a class="orange-d"><?=lang('label_ngos_stats')?></a></li>
							</ul>
						</div>
						<script>
							$('.sec-menu li.description').click(function() {
								$('.ngo > .info').show();
								$('.ngo > .projects').hide();
								$('.ngo > .stats').hide();
							});
							$('.sec-menu li.projects').click(function() {
								$('.ngo > .info').hide();
								$('.ngo > .projects').show();
								$('.ngo > .stats').hide();
							});
							$('.sec-menu li.stats').click(function() {
								$('.ngo > .info').hide();
								$('.ngo > .projects').hide();
								$('.ngo > .stats').show();
							});
						</script>
					</div>

					<div class="info">
						<div class="images">
							<?php 
								foreach($ngo->images as $i) {
									$path_info = pathinfo($i->file);
									$name = $path_info['filename'];
									$ext = $path_info['extension'];
									
									$img_path	= "/static/ngo/".$ngo->id."/".$i->file;
									$thumb_path	= "/static/ngo/$ngo->id/$name"."_thumb.".$ext;
							?>
								<a href="<?=$img_path?>" class="fb"><img src="<?=$thumb_path?>" alt="<?=$i->label?>" title="<?=$i->label?>" height="100px;" /></a>	
							<?php } ?>
							<script>
								$(document).ready(function() {
									$("a.fb").fancybox();
								});
							</script>
						</div>
						<div class="description">
							<h1><?=lang('label_ngos_description')?></h1>
							<?=$ngo->description?>
						</div>
					</div>
					
					<div class="projects hidden">
						<h1><?=lang('label_ngos_projects')?></h1>
						<?php foreach($ngo->projects as $p) : ?>
							<?=$p->name?><br/>
						<?php endforeach; ?>
					</div>
					
					<div class="stats hidden">
						<h1><?=lang('label_ngos_stats')?></h1>
						<center>There are still no stats to show</center>
					</div>
				</div>
				<div class="ngo-bottom-wrapper">
					<div class="ngo-bottom-bg"></div>
				</div>
				<div class="ngo-left-wrapper">
					<div class="ngo-left-bg"></div>
				</div>
			</div>
		</div>
		<div class="ngo-search shadow-thin">
		<?=form_open('/ngos/search') ?>
			<h1 class="orange-d"><?=lang('label_ngos_search_title')?></h1>

			<?=form_fieldset(lang('label_ngos_search_keywords'))?>
				<?=form_input($keywords) ?>
			<?=form_fieldset_close()?>
			
			<?=form_fieldset(lang('label_ngos_search_areas'))?>
				<?=form_multiselect('areas[]', $areas)?>
			<?=form_fieldset_close()?>
			
			<?=form_fieldset(lang('label_ngos_search_countries'))?>
				<?=form_multiselect('countries[]', $countries)?>
			<?=form_fieldset_close()?>
			
			<?=form_fieldset(lang('label_ngos_search_causes'))?>
				<?=form_multiselect('causes[]', $causes)?>
			<?=form_fieldset_close()?>
			
			<?=form_fieldset(lang('label_ngos_search_size'))?>
				<table cellpadding="5px;">
					<tr>
						<td><?=form_checkbox('size', '1', TRUE)?></td>
						<td><?=lang('label_ngos_search_size_very_small')?><br/>(1-10 <?=strtolower(lang('label_ngos_search_size_volunteers'))?>)</td>
					</tr>
					<tr>
						<td><?=form_checkbox('size', '2', TRUE)?></td>
						<td><?=lang('label_ngos_search_size_small')?><br/>(11-50 <?=strtolower(lang('label_ngos_search_size_volunteers'))?>)</td>
					</tr>
					<tr>
						<td><?=form_checkbox('size', '3', TRUE)?></td>
						<td><?=lang('label_ngos_search_size_medium')?><br/>(51-250 <?=strtolower(lang('label_ngos_search_size_volunteers'))?>)</td>
					</tr>
					<tr>
						<td><?=form_checkbox('size', '3', TRUE)?></td>
						<td><?=lang('label_ngos_search_size_large')?><br/>(+250 <?=strtolower(lang('label_ngos_search_size_volunteers'))?>)</td>
					</tr>
				</table>
			<?=form_fieldset_close()?>
			<?=form_submit($submit) ?>
			<script>
			$(function() {
				$( "input.form-button" ).button();
			});
			</script>
		<?=form_close() ?>
		</div>
	</div>
	<?php endforeach; ?>
</div>